<template>
  <div id="jbxx" style='text-align:center;width:790px;margin:0 auto;'>
    <p>
      <strong>&nbsp;</strong>
    </p>
    <p style="font-size:32px;margin-top:20px">
      <strong>个人基本信息表</strong>
    </p>
    <p>
      <strong style="padding-right:20%">姓名：&nbsp;&nbsp;&nbsp;&nbsp;{{form.name}}</strong>
      <strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </strong>
      <strong sttle="padding-right:20%">编号:&nbsp;&nbsp;&nbsp;&nbsp;{{dnbh}}</strong>
    </p>
    <table width="789" border='1' cellspacing="0" style="margin:auto;font-family:'SimHei';text-align:center;" v-loading="loading">
      <tbody>
        <tr>
          <td colspan="2" width="130">
            <p>性&nbsp; 别</p>
          </td>
          <td colspan="4" width="352">
            <p class="p_left">
              <span>1男&nbsp; 2女&nbsp; 9未说明的性别&nbsp; 0未知的性别&nbsp;
              </span>
              <span class='square'>{{form.xb}}</span>
            </p>
          </td>
          <td colspan="2" width="83">
            <p>出生日期</p>
          </td>
          <td width="224">
            <p>
              <span class='square'>{{csrqArr[0]}}</span>
              <span class='square'>{{csrqArr[1]}}</span>
              <span class='square'>{{csrqArr[2]}}</span>
              <span class='square'>{{csrqArr[3]}}</span>
              &nbsp;
              <span class='square'>{{csrqArr[5]}}</span>
              <span class='square'>{{csrqArr[6]}}</span>
              &nbsp;
              <span class='square'>{{csrqArr[8]}}</span>
              <span class='square'>{{csrqArr[9]}}</span>
            </p>
          </td>
        </tr>
        <tr>
          <td colspan="2" width="130">
            <p>身份证号</p>
          </td>
          <td colspan="2" width="263">
            <p>{{form.sfzh}}</p>
          </td>
          <td colspan="2" width="119">
            <p>工作单位</p>
          </td>
          <td colspan="3" width="277">
            <p>{{form.gzdw}}</p>
          </td>
        </tr>
        <tr>
          <td colspan="2" width="130">
            <p>本人电话</p>
          </td>
          <td width="107">
            <p>{{form.brdh}}</p>
          </td>
          <td width="136">
            <p>联系人姓名</p>
          </td>
          <td colspan="2" width="119">
            <p>{{form.lxrxm}}</p>
          </td>
          <td colspan="2" width="173">
            <p>联系人电话</p>
          </td>
          <td width="184">
            <p>{{form.lxrdh}}</p>
          </td>
        </tr>
        <tr>
          <td colspan="2" width="130">
            <p>常住类型</p>
          </td>
          <td colspan="2" width="263">
            <p class="p_left">1户籍&nbsp;&nbsp; 2非户籍&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </p>
            <p class="p_right">
              <span class='square'>{{form.czlx}}</span>
            </p>
          </td>
          <td colspan="2" width="119">
            <p>民&nbsp; 族</p>
          </td>
          <td colspan="3" width="277">
            <p class="p_left">
              <span>1汉族&nbsp;&nbsp;99少数民族&nbsp;&nbsp;&nbsp; </span>
              <u class="unline_jbxx">{{minzuStr}}</u>
            </p>
            &nbsp;
            <p class="p_right">
              <span class='square'>{{form.minzu=='1'?"1":"99"}}</span>
            </p>
          </td>
        </tr>
        <tr>
          <td colspan="2" width="130">
            <p>血&nbsp;&nbsp;&nbsp; 型</p>
          </td>
          <td colspan="7" width="659">
            <p class="p_left">
              <span>1 A型&nbsp;&nbsp; 2 B型&nbsp;&nbsp; 3 O型&nbsp;&nbsp; 4 AB型&nbsp; 5不详 / Rh：1阴性&nbsp;&nbsp; 2阳性&nbsp;&nbsp; 3不详&nbsp;
              </span>
            </p>
            <p class="p_right">
              <span class='square'>{{form.xuexing}}</span>
              <span>/</span>
              <span class='square'>{{form.rh}}</span>
            </p>
          </td>
        </tr>
        <tr>
          <td colspan="2" width="130">
            <p>文化程度</p>
          </td>
          <td colspan="7" width="659">
            <p class="p_left">1研究生&nbsp; 2大学本科&nbsp; 3大学专科和专科学校&nbsp; 4中等专业校&nbsp;5技工学校&nbsp;6高中&nbsp; 7初中 </p>
            <p class="p_left">8小学&nbsp;&nbsp;&nbsp;&nbsp; 9文盲及半文盲&nbsp;&nbsp;&nbsp;&nbsp; 10不详
            </p>
            <p class="p_right">
              <span class='square'>{{form.whcd}}</span>
            </p>
          </td>
        </tr>
        <tr>
          <td colspan="2" width="130">
            <p>职&nbsp;&nbsp;&nbsp; 业</p>
          </td>
          <td colspan="7" width="659">
            <p class="p_left">0国家机关、党群组织、企、事业单位负责人&nbsp; 1专业技术人员&nbsp; 2办事人员和有关人员 </p>
            <p class="p_left">3商业、服务业人员&nbsp;&nbsp;&nbsp; 4农、林、牧、渔、水利业生产人员&nbsp;&nbsp;&nbsp;&nbsp; 5生产、运输设备操作人&nbsp;&nbsp;</p>
            <p class="p_left">员及有关人员&nbsp;&nbsp;6军人&nbsp;&nbsp; 7不便分类的其他从业人员&nbsp;&nbsp; 8无职业
            </p>
            <p class="p_right">
              <span class='square'>{{form.zhiye}}</span>
            </p>
          </td>
        </tr>
        <tr>
          <td colspan="2" width="130">
            <p>婚姻状况</p>
          </td>
          <td colspan="7" width="659">
            <p class="p_left">1未婚&nbsp; 2 已婚&nbsp; 3丧偶&nbsp; 4离婚&nbsp; 5未说明的婚姻状况</p>
            <p class="p_right">
              <span class="square">{{form.hyqk}}</span>
            </p>
          </td>
        </tr>
        <tr>
          <td colspan="2" width="130">
            <p>医疗费用</p>
            <p>支付方式</p>
          </td>
          <td colspan="7" width="659">
            <p class="p_left">1城镇职工基本医疗保险&nbsp; 2城镇居民基本医疗保险&nbsp; 3新型农村合作医疗</p>
            <p class="p_left">4贫困救助&nbsp; 5商业医疗保险&nbsp;&nbsp; 6全公费&nbsp; 7全自费&nbsp; 8其他
              <!-- <u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </u> -->
            </p>
            <p class="p_right">
              <span class="square">{{form.ylfy}}</span>
            </p>
          </td>
        </tr>
        <tr>
          <td colspan="2" width="130">
            <p>药物过敏史</p>
          </td>
          <td colspan="7" width="659">
            <p class="p_left">1无&nbsp;&nbsp; 2青霉素&nbsp;&nbsp; 3磺胺&nbsp;&nbsp; 4链霉素&nbsp;&nbsp; 5其他 &nbsp;&nbsp;
              <u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{form.ywgmsDes}}&nbsp;&nbsp;&nbsp; </u>&nbsp;</p>
            <p class="p_right">
              <span v-for="(v,index) in (form.ywgms==null?'':form.ywgms.split(','))" :key="v">
                <span class="square">{{v}}</span>
                <span v-if="index!==(form.ywgms==null?'':form.ywgms.split(',').length-1)">/</span>
              </span>
            </p>
          </td>
        </tr>
        <tr>
          <td colspan="2" width="130">
            <p>暴 露 史</p>
          </td>
          <td colspan="7" width="659">
            <p class="p_left">1无&nbsp;&nbsp; 2化学品&nbsp;&nbsp;&nbsp;&nbsp; 3毒物&nbsp;&nbsp;&nbsp;&nbsp; 4射线
            </p>
            <p class="p_right">
              <span v-for="(v,index) in form.blshi==null?'':form.blshi.split(',')" :key="v">
                <span class="square">{{v}}</span>
                <span v-if="index!==(form.blshi==null?'':form.blshi.split(',').length-1)">/</span>
              </span>
            </p>
          </td>
        </tr>
        <tr>
          <td rowspan="4" width="48">
            <p>既 往 史</p>
          </td>
          <td width="82">
            <p>疾病</p>
          </td>
          <td colspan="7" width="659">
            <p style="text-align:left;padding-left:10px">1无&nbsp; 2高血压&nbsp; 3糖尿病&nbsp; 4冠心病&nbsp; 5慢性阻塞性肺疾病 6恶性肿瘤</p>
            <p style="text-align:left;padding-left:10px">7脑卒中&nbsp; 8严重精神障碍 9结核病&nbsp; 10肝炎&nbsp; 11其他法定传染病 12职业病</p>
            <p style="text-align:left;padding-left:10px">13其他疾病
              <u>
                <span v-for="i in jbjwsArr.length" :key="i">{{jbjwsArr[i-1].qita }}</span>
              </u>
            </p>
            <p class="p_left">
              <span style="border: 1px solid #000;text-align: center;line-height: 18px;">{{jbjwsArr.length>0?jbjwsArr[0].index:'&nbsp;'}}</span>
              <span style="display:inline-block;width:190px;text-align:left;">确诊时间:
                <u style="margin-left:5px">{{jbjwsArr.length>0?jbjwsArr[0].qzsj:'&nbsp;'}}</u>
              </span>
              <span style="border: 1px solid #000;text-align: center;line-height: 18px;">{{jbjwsArr.length>1?jbjwsArr[1].index:'&nbsp;'}}</span>
              <span style="display:inline-block;width:190px;text-align:left">确诊时间:
                <u style="margin-left:5px">{{jbjwsArr.length>1?jbjwsArr[1].qzsj:'&nbsp;'}}</u>
              </span>
              <span style="border: 1px solid #000;text-align: center;line-height: 18px;">{{jbjwsArr.length>2?jbjwsArr[2].index:'&nbsp;'}}</span>
              <span style="display:inline-block;width:190px;text-align:left">确诊时间:
                <u style="margin-left:5px">{{jbjwsArr.length>2?jbjwsArr[2].qzsj:'&nbsp;'}}</u>
              </span>
            </p>
            <p class="p_left">
              <span style="border: 1px solid #000;text-align: center;line-height: 18px;">{{jbjwsArr.length>3?jbjwsArr[3].index:'&nbsp;'}}</span>
              <span style="display:inline-block;width:190px;text-align:left">确诊时间:
                <u style="margin-left:5px">{{jbjwsArr.length>3?jbjwsArr[3].qzsj:'&nbsp;'}}</u>
              </span>
              <span style="border: 1px solid #000;text-align: center;line-height: 18px;">{{jbjwsArr.length>4?jbjwsArr[4].index:'&nbsp;'}}</span>
              <span style="display:inline-block;width:190px;text-align:left">确诊时间:
                <u style="margin-left:5px">{{jbjwsArr.length>4?jbjwsArr[4].qzsj:'&nbsp;'}}</u>
              </span>
              <span style="border: 1px solid #000;text-align: center;line-height: 18px;">{{jbjwsArr.length>5?jbjwsArr[5].index:'&nbsp;'}}</span>
              <span style="display:inline-block;width:190px;text-align:left">确诊时间:
                <u style="margin-left:5px">{{jbjwsArr.length>5?jbjwsArr[5].qzsj :'&nbsp;'}}</u>
              </span>
            </p>
          </td>
        </tr>
        <tr>
          <td width="82">
            <p>手 术</p>
          </td>
          <td colspan="7" width="659">
            <p class="p_left">
              <span class="span" style="font-size: 16px;">
                1无&nbsp;2有：名称①
                <span class="unline_jbxx" style="font-size: 15px;">{{ssjwsArr.length>0?ssjwsArr[0].name:'&nbsp;&nbsp;'}}</span> 时间
                <span class="unline_jbxx" style="font-size: 15px;">{{ssjwsArr.length>0?ssjwsArr[0].qzsj:'&nbsp;&nbsp;'}}</span>/ 名称②
                <span class="unline_jbxx" style="font-size: 15px;">{{ssjwsArr.length>1?ssjwsArr[1].name:'&nbsp;&nbsp;'}}</span>时间
                <span class="unline_jbxx" style="font-size: 15px;">{{ssjwsArr.length>1?ssjwsArr[1].qzsj:'&nbsp;&nbsp;'}}</span>
              </span>
            </p>
            <p class="p_right">
              <span class="square">1</span>
            </p>
          </td>
        </tr>
        <tr>
          <td width="82">
            <p>外 伤</p>
          </td>
          <td colspan="7" width="659">
            <p class="p_left">
              <span class="span" style="font-size: 16px;">
                1无&nbsp;2有：名称①
                <span class="unline_jbxx" style="font-size: 15px;">{{wsjwsArr.length>0?wsjwsArr[0].name:'&nbsp;&nbsp;'}}</span> 时间
                <span class="unline_jbxx" style="font-size: 15px;">{{wsjwsArr.length>0?wsjwsArr[0].qzsj:'&nbsp;&nbsp;'}}</span>/ 名称②
                <span class="unline_jbxx" style="font-size: 15px;">{{wsjwsArr.length>1?wsjwsArr[1].name:'&nbsp;&nbsp;'}}</span>时间
                <span class="unline_jbxx" style="font-size: 15px;">{{wsjwsArr.length>1?wsjwsArr[1].qzsj:'&nbsp;&nbsp;'}}</span>
              </span>
            </p>
            <p class="p_right">
              <span class="square">1</span>
            </p>
          </td>
        </tr>
        <tr>
          <td width="82">
            <p>输 血&nbsp;</p>
          </td>
          <td colspan="7" width="659">
            <p class="p_left">
              <span class="span" style="font-size: 16px;">
                1无&nbsp;2有：原因①
                <span class="unline_jbxx" style="font-size: 15px;">{{sxjwsArr.length>0?sxjwsArr[0].name:'&nbsp;&nbsp;'}}</span>时间
                <span class="unline_jbxx" style="font-size: 15px;">{{sxjwsArr.length>0?sxjwsArr[0].qzsj:'&nbsp;&nbsp;'}}</span>/ 原因②
                <span class="unline_jbxx" style="font-size: 15px;">{{sxjwsArr.length>1?sxjwsArr[1].name:'&nbsp;&nbsp;'}}</span>时间
                <span class="unline_jbxx" style="font-size: 15px;">{{sxjwsArr.length>1?sxjwsArr[1].qzsj:'&nbsp;&nbsp;'}}</span>
              </span>
            </p>
            <p class="p_right">
              <span class="square">1</span>
            </p>
          </td>
        </tr>
        <tr>
          <td colspan="2" rowspan="3" width="130">
            <p>家 族 史</p>
          </td>
          <td width="100">
            <p>父&nbsp;&nbsp;&nbsp; 亲</p>
          </td>
          <td colspan="2" width="451">
            <p>
              <span v-for="(v,index) in form.jzsfq==null?'':form.jzsfq.split(',')" :key="v">
                <span class="square">{{v}}</span>
                <span v-if="index!==(form.jzsfq==null?'':form.jzsfq.split(',').length-1)">/</span>
              </span>
            </p>
          </td>
          <td colspan="2" width="100">
            <p>母&nbsp; 亲</p>
          </td>
          <td colspan="2" width="221">
            <p>
              <span v-for="(v,index) in form.jzsmq==null?'':form.jzsmq.split(',')" :key="v">
                <span class="square">{{v}}</span>
                <span v-if="index!==(form.jzsmq==null?'':form.jzsmq.split(',').length-1)">/</span>
              </span>
            </p>
          </td>
        </tr>
        <tr>
          <td width="100">
            <p>兄弟姐妹</p>
          </td>
          <td colspan="2" width="451">
            <p>
              <span v-for="(v,index) in form.jzsxdjm==null?'':form.jzsxdjm.split(',')" :key="v">
                <span class="square">{{v}}</span>
                <span v-if="index!==( form.jzsxdjm==null?'':form.jzsxdjm.split(',').length-1)">/</span>
              </span>
            </p>
          </td>
          <td colspan="2" width="100">
            <p>子&nbsp; 女</p>
          </td>
          <td colspan="2" width="221">
            <p>
              <span v-for="(v,index) in form.jzszn==null?'':form.jzszn.split(',')" :key="v">
                <span class="square">{{v}}</span>
                <span v-if="index!==(form.jzszn==null?'':form.jzszn.split(',').length-1)">/</span>
              </span>
            </p>
          </td>
        </tr>
        <tr>
          <td colspan="7" width="659">
            <p class="p_left">1无&nbsp; 2高血压&nbsp; 3糖尿病&nbsp; 4冠心病&nbsp; 5慢性阻塞性肺疾病&nbsp; 6恶性肿瘤&nbsp; 7脑卒中</p>
            <p class="p_left">
              <span class="span">
                8严重精神障碍&nbsp; 9结核病&nbsp; 10肝炎&nbsp; 11先天畸形&nbsp; 12其他
                <span class="unline_jbxx" style="width:200px">{{form.jzsfqDes}}&nbsp; {{form.jzsxdjmDes}}&nbsp;{{form.jzsznDes}}&nbsp;{{form.jzsmqDes}}</span>
              </span>
            </p>

          </td>
        </tr>
        <tr>
          <td colspan="2" width="130">
            <p>遗传病史</p>
          </td>
          <td colspan="7" width="659">
            <p class="p_left">
              <span class="span">
                1无 2有：疾病名称
                <span class="unline_jbxx" style="width:400px">{{form.ycbDes}}</span>
              </span>
            </p>
            <p class="p_right">
              <span class='square'>{{form.ycbs}}</span>
            </p>
          </td>
        </tr>
        <tr>
          <td colspan="2" width="130">
            <p>残疾情况</p>
          </td>
          <td colspan="7" width="659">
            <p class="p_left">1无残疾 2 视力残疾 3听力残疾 4言语残疾 5 肢体残疾 6智力残疾</p>
            <p class="p_left">
              <span class="span">
                7精神残疾&nbsp; 8其他残疾
                <span class="unline_jbxx" style="width:300px">{{form.qtcj}}</span>
              </span>
            </p>
            <p class="p_right">
              <span v-for="(v,index) in form.cjqk==null?'':form.cjqk.split(',')" :key="v">
                <span class="square">{{v}}</span>
                <span v-if="index!==(form.cjqk==null?'':form.cjqk.split(',').length-1)">/</span>
              </span>
            </p>
          </td>
        </tr>
        <tr>
          <td colspan="2" rowspan="5" width="130">
            <p>生活环境*</p>
          </td>
          <td width="107">
            <p>厨房排风设施</p>
          </td>
          <td colspan="6" width="552">
            <p class="p_left">
              1无 &nbsp; &nbsp;2油烟机 &nbsp;&nbsp;3换气扇&nbsp;&nbsp; 4烟囱
            </p>
            <p class="p_right">
              <span class='square'>{{form.shhjcfpfcs}}</span>
            </p>
          </td>
        </tr>
        <tr>
          <td width="107">
            <p>燃料类型</p>
          </td>
          <td colspan="6" width="552">
            <p class="p_left">
              1液化气&nbsp;&nbsp; 2煤&nbsp;&nbsp; 3天然气&nbsp;&nbsp; 4沼气&nbsp;&nbsp; 5柴火&nbsp; 6其他
            </p>
            <p class="p_right">
              <span class='square'>{{form.shhjrllx}}</span>
            </p>
          </td>
        </tr>
        <tr>
          <td width="107">
            <p>饮水</p>
          </td>
          <td colspan="6" width="552">
            <p class="p_left">
              1自来水&nbsp;&nbsp; 2经净化过滤的水&nbsp;&nbsp; 3井水&nbsp; 4河湖水&nbsp; 5塘水 &nbsp;6其他
            </p>
            <p class="p_right">
              <span class='square'>{{form.shhjys}}</span>
            </p>
          </td>
        </tr>
        <tr>
          <td width="107">
            <p>厕所</p>
          </td>
          <td colspan="6" width="552">
            <p class="p_left">
              1卫生厕所 2一格或二格粪池式 3马桶&nbsp; 4露天粪坑&nbsp; 5简易棚厕
            </p>
            <p class="p_right">
              <span class='square'>{{form.shhjcs}}</span>
            </p>
          </td>
        </tr>
        <tr>
          <td width="107">
            <p>禽畜栏</p>
          </td>
          <td colspan="6" width="552">
            <p class="p_left">
              1无&nbsp;&nbsp;&nbsp; 2单设&nbsp;&nbsp;&nbsp; 3室内&nbsp;&nbsp;&nbsp; 4室外
            </p>
            <p class="p_right">
              <span class='square'>{{form.shhjqcl}}</span>
            </p>
          </td>
        </tr>
      </tbody>
    </table>
  </div>
</template>
<script>
import { getObj } from '@/api/cust/base'
import { fetchList } from '@/api/cust/previoushis'
import { getIndex } from '@/const/cust/cust_dic'
import { getStore } from '@/util/store.js'
import '@/styles/report.scss'
export default {
  data() {
    return {
      loading: false,
      form: {
        cjqk: '',
        jzsxdjm: '',
        jzsmq: '',
        jzsfq: '',
        dnbh: '',
        bls: '',
        ywgms: ''
      },
      custlPage: {
        total: 0,
        currentPage: 1,
        pageSize: 20
      },
      jbjwsArr: [],
      ssjwsArr: [],
      wsjwsArr: [],
      sxjwsArr: [],
      csrqArr: [],
      minzuStr: '',
      grjbxxid: this.$route.query.grjbxxid
    }
  },
  created() {
    const jkdn = getStore({ name: 'jkdn' })
    this.dnbh = jkdn.dnbh
    this.getDetail()
  },
  mounted() {},
  methods: {
    getDetail() {
      getObj(this.grjbxxid).then(res => {
        this.form = res.data
        this.csrqArr = res.data.csrq == null ? '' : res.data.csrq.split('')
      })
      ;(this.jbjwsArr = []),
        (this.ssjwsArr = []),
        (this.wsjwsArr = []),
        (this.sxjwsArr = []),
        fetchList(
          Object.assign({
            grjbxxid: this.grjbxxid,
            start: (this.custlPage.currentPage - 1) * this.custlPage.pageSize,
            length: this.custlPage.pageSize
          })
        ).then(res => {
          var list = res.data.data
          list.forEach(ele => {
            if (ele.jwslx == '疾病') {
              this.jbjwsArr.push({
                index: getIndex(ele.mingcheng),
                qzsj: ele.qzsj,
                qita: ele.qita
              })
            } else if (ele.jwslx == '手术') {
              this.ssjwsArr.push({ name: ele.mingcheng, qzsj: ele.qzsj })
            } else if (ele.jwslx == '外伤') {
              this.wsjwsArr.push({ name: ele.mingcheng, qzsj: ele.qzsj })
            } else {
              this.sxjwsArr.push({ name: ele.mingcheng, qzsj: ele.qzsj })
            }
          })
        })
    },
    breaks() {}
  },
  computed: {},
  props: []
}
</script>
<style scoped>
.unline_jbxx {
  font-size: 16px;
  border: none;
  border-bottom: black solid 1px;
  margin-bottom: 3px;
  width: 80px;
  line-height: 18px;
}
p {
  font-size: 15px;
  /* font-family: '宋体' */
}
td {
  line-height: 24px;
}
</style>